package org.dromara.system.proto;

//import com.alibaba.fastjson2.JSONObject;
//import io.grpc.stub.StreamObserver;
//import lombok.RequiredArgsConstructor;
//import org.dromara.common.core.domain.R;
//import org.dromara.speed.proto.ExternalServiceGrpc;
//import org.dromara.speed.proto.PushOrderRequest;
//import org.dromara.speed.proto.PushOrderResponse;
//import org.dromara.system.domain.bo.aparams.AOrderBo;
//import org.dromara.system.kernel.OrderInsertKernel;
//import org.lognet.springboot.grpc.GRpcService;
//
//@RequiredArgsConstructor
//@GRpcService
//public class GRpcOrderServiceImpl extends ExternalServiceGrpc.ExternalServiceImplBase {
//
//    private final OrderInsertKernel orderInsertKernel;
//
//
//    @Override
//    public void pushOrder(PushOrderRequest request, StreamObserver<PushOrderResponse> responseObserver) {
//        // 处理请求并返回响应
//        AOrderBo bo = JSONObject.parseObject(request.getParams(), AOrderBo.class);
//
//        //处理业务逻辑
//        R<?> r = orderInsertKernel.pushOrder(bo, request.getSecretKey());
//
//        // 构建 Protobuf 响应
//        PushOrderResponse response = PushOrderResponse.newBuilder()
//            .setParams(JSONObject.toJSONString(r))  // 示例：生成订单号的方法
//            .build();
//        // 返回响应给客户端
//        responseObserver.onNext(response);
//        responseObserver.onCompleted();
//    }
//}
